#define _CRT_SECURE_NO_WARNINGS 1
int* productExceptSelf(int* nums, int numsSize, int* returnSize) {
    *returnSize = numsSize;
    int* answer = (int*)malloc(numsSize * sizeof(int));
    answer[0] = 1;
    for (int i = 1; i < numsSize;i++)
    {
        answer[i] = nums[i - 1] * answer[i - 1];
    }
    int R = 1;
    for (int i = numsSize - 1; i >= 0; i--)
    {
        answer[i] = R * answer[i];
        R *= nums[i];
    }
    return answer;
}